package com.atguigu.yygh.mq;

import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;

/**
 * @author mgx
 * @version 1.0
 * @description: TODO
 * @date 2022/9/7 21:39
 */
@SpringBootConfiguration
public class RabbitConfig {

    // MessageConverter会自动把生产者发送到mq的pojo对象转化为json数据
    // 消费者取消息的时候会自动把json数据转化为pojo对象
    @Bean
    public MessageConverter getMessageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}
